package com.example.leakcanary;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

public class MainActivity extends AppCompatActivity {

    TextView mTvText;
    private static A a;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mTvText = (TextView) findViewById(R.id.tv);
        a = new A();
//        LeakSingle.getInstance(this.getApplication()).setRetainedTextView(mTvText);
//        handler.postDelayed(runnable,0);
        Intent intent = new Intent(this,Main2Activity.class);
        startActivity(intent);
        finish();
    }

    public static int count=0;
    Handler handler = new Handler();
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            Toast.makeText(MainActivity.this,"times="+count++, Toast.LENGTH_SHORT).show();
            handler.postDelayed(this,1000);
        }
    };

    class A{

    };

    @Override
    protected void onDestroy() {
        super.onDestroy();
//        LeakSingle.getInstance(this.getApplication()).removeRetainedTextView();
    }
}
